#include <vector>
#include <iostream>
using namespace std;

int maxSubsetSum(vector<int> array) {
  // 在这里作答
  if (array.size() == 1) { return array[0]; }

  vector<int> sums = array;
  sums[0] = array[0];
  sums[1] = max(array[0], array[1]);

  for (int i = 2; i < array.size(); ++i) {
    sums[i] = max(sums[i - 1], sums[i - 2] + array[i]);
  }

  return sums[sums.size() - 1];
}

int main() {
  cout<<maxSubsetSum(vector<int> {7, 10, 12, 7, 9, 14})<<endl;
}